<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>文章列表</title>
    <!-- 加载所需的js和css -->
    <link rel="stylesheet" href="/assets/lib/layui/css/layui.css">
    <link rel="stylesheet" href="/assets/css/article/article.css">​

    <script src="/assets/lib/jquery.js"></script>
    <script src="/assets/lib/layui/layui.all.js"></script>
    <!-- 加载模板引擎 -->
    <script src="/assets/lib/template-web.js"></script>
    <script src="/assets/js/common.js"></script>
    <script src="/assets/js/article/article.js"></script>
</head>

<body>
    <div class="layui-card">
        <div class="layui-card-header">文章列表</div>
        <div class="layui-card-body">
            <!-- 搜索区 -->
            <form id="search-from" class="layui-form" action="">
                <div class="layui-form-item">

                    <div class="layui-inline">
                        <div class="layui-input-inline" style="width: 200px;">
                            <select id="category" name="cate_id" lay-verify="">
                                <!-- <option value="">所有分类</option>
                                <option value="010">音乐</option>
                                <option value="021">财经</option>
                                <option value="0571">经典</option> -->
                            </select>
                        </div>
                        <div class="layui-input-inline" style="width: 200px;">
                            <select name="state" lay-verify="">
                                <option value="">请选择状态</option>
                                <option value="已发布">已发布</option>
                                <option value="草稿">草稿</option>
                            </select>
                        </div>
                    </div>

                    <div class="layui-inline">
                        <div class="layui-input-inline" style="width: 80px;">
                            <button class="layui-btn" lay-submit lay-filter="formDemo">筛选</button>
                        </div>
                    </div>

                </div>
            </form>
            <!-- 表格内容区 -->
            <table class="layui-table">
                <colgroup>
                    <col width="40%">
                    <col width="15%">
                    <col width="20%">
                    <col width="15%">
                    <col>
                </colgroup>
                <thead>
                    <tr>
                        <th>文章标题</th>
                        <th>分类</th>
                        <th>发表时间</th>
                        <th>状态</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>
                    <!-- 存放数据 -->
                    <!-- <tr>
                        <td>人不能做咸鱼</td>
                        <td>做个好人</td>
                        <td>2020-6-13</td>
                        <td>已发布</td>
                        <td>
                            <button type="button" class="layui-btn layui-btn-xs">编辑</button>
                            <button type="button" class="layui-btn layui-btn-xs layui-btn-danger">删除</button>
                        </td>
                    </tr> -->
                </tbody>
            </table>
            <!-- 分页区 -->
            <div id="page"></div>
        </div>
    </div>

    <!-- <td>{{val.cate_name | 过滤器函数}}</td> -->
    <!-- 文章列表模板 -->
    <script type="text/html" id="tpl-article">
        {{each data val}}
        <tr>
            <td>{{val.title}}</td>
            <td>{{val.cate_name | add123}}</td>
            <td>{{val.pub_date | formatDate}}</td>
            <td>{{val.state}}</td>
            <td>
                <a href="/article/edit.html?id={{val.Id}}" target="fm" class="layui-btn layui-btn-xs">编辑</a>
                <button data-id="{{val.Id}}" type="button" class="layui-btn layui-btn-xs layui-btn-danger delete">删除</button>
            </td>
        </tr>
        {{/each}}
    </script>

    <!-- 下拉框分类的模板 -->
    <script type="text/html" id="tpl-category">
        <option value="">请选择分类</option>
        {{each data val}}
        <option value="{{val.Id}}">{{val.name}}</option>
        {{/each}}
    </script>
</body>

</html>